
const controller = "/sqlDatabase";
 class ScriptApi {

    constructor(request,message){
        this.request = request;
        this.message = message
    }


    /**
     * 执行单条sql
     * @param params
     * @returns {Promise<T>}
     */
   async singleExecute  (params) {
        const res =  await this.request.post(`${controller}/executeScript`, params);
        //没有数据就设置空数据
        if (!res.data) {
            return;
        }
        const result = res.data[0];
        if (result.success) {
            return result;
        } else {
            this.message.error(result.message);
        }
    }
}

export{
    ScriptApi
}